package com.app.fenak.validation;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

import android.util.Log;

public class ServicesUrls {

	public static String LOGIN_URL = "http://dev.pitechnologies.net/fenak/login.php"; // POST
	public static String LOGIN_PARAM_USER_EMAIL = "user_email";
	public static String LOGIN_PARAM_PASSWORD = "password";

	public static String FORGET_PASSWORD_URL = "http://dev.pitechnologies.net/fenak/forgetPassword.php"; // POST
	public static String FORGET_PASSWORD_PARAM_EMAIL = "email";

	public static String REGISTER_URL = "http://dev.pitechnologies.net/fenak/register.php"; // POST
	public static String REGISTER_PARAM_FIRST_NAME = "user_fname";
	public static String REGISTER_PARAM_LAST_NAME = "user_lname";
	public static String REGISTER_PARAM_EMAIL = "user_email";
	public static String REGISTER_PARAM_USERNAME = "userName";
	public static String REGISTER_PARAM_PASSWORD = "password";

	public static String CHECK_USERNAME_URL = "http://dev.pitechnologies.net/fenak/check_userName.php"; // POST
	public static String CHECK_USERNAME_PARAM_USERNAME = "userName";
	public static String CHECK_USERNAME_PARAM_PASSWORD = "password";

	public static String CHECK_EMAIL_URL = "http://dev.pitechnologies.net/fenak/check_email.php"; // POST
	public static String CHECK_EMAIL_PARAM_EMAIL = "email";

	public static String SAVE_PATH_URL = "http://dev.pitechnologies.net/fenak/save_complete_path.php"; // POST

	public static String REMOVE_FROM_SESSION_URL = "http://dev.pitechnologies.net/fenak/remove_contact_from_session.php"; // POST
	public static String REMOVE_FROM_SESSION_PARAM_SESSION_ID = "session_id";
	public static String REMOVE_FROM_SESSION_PARAM_USER_ID = "user_id";

	public static String REMOVE_CONTACT_URL = "http://dev.pitechnologies.net/fenak/remove_contact_from_contacts.php"; // POST
	public static String REMOVE_CONTACT_PARAM_USER_ID = "user_id";

	public static String GET_PUBLIC_CONTACT_PATHS_URL = "http://dev.pitechnologies.net/fenak/get_public_and_contact_paths.php"; // POST
	public static String GET_PUBLIC_CONTACT_PATHS_PARAM_USER_ID = "user_id";

	public static String GET_PATH_BY_ID_URL = "http://dev.pitechnologies.net/fenak/get_paths.php"; // GET
	public static String GET_PATH_BY_ID_PARAM_PATHS_IDS = "path_ids";

	public static String ADD_CONTACT_URL = "http://dev.pitechnologies.net/fenak/add_contact.php"; // GET
	public static String ADD_CONTACT_PARAM_USER_ID = "user_id";
	public static String ADD_CONTACT_PARAM_FRIEND_USER_ID = "user_friend_id";
	public static String ADD_CONTACT_PARAM__REQ_DATE = "req_date";

	public static String SEARCH_CONTACT_URL = "http://dev.pitechnologies.net/fenak/search_contact_service.php"; // POST
	public static String SEARCH_CONTACT_PARAM_USERNAME = "user_name";

	public static String ACCEPT_INVITATION_URL = "http://dev.pitechnologies.net/fenak/accept_invitation_service.php"; // POST
	public static String ACCEPT_INVITATION_PARAM_INVITE_STATUS = "invit_status";
	public static String ACCEPT_INVITATION_PARAM_SESSION_ID = "session_id";
	public static String ACCEPT_INVITATION_PARAM_USER_ID = "user_id";
	public static String ACCEPT_INVITATION_PARAM_INVITED_USER_ID = "invit_user_id";
	public static String ACCEPT_INVITATION_PARAM_SHARE_TIME = "share_time";
	public static String ACCEPT_INVITATION_PARAM_OWNER_USER_ID = "creator";
	public static String ACCEPT_INVITATION_PARAM_IS_SESSION_VALID = "valid";

	public static String SEND_INVITATION_URL = "http://dev.pitechnologies.net/fenak/send_invitation_service.php"; // GET
	public static String SEND_INVITATION_PARAM_USER_ID = "user_id";
	public static String SEND_INVITATION_PARAM_INVITED_USER_ID = "invit_user_id";

	public static String RESPOND_TO_ADD_CONTACT_URL = "http://dev.pitechnologies.net/fenak/respond_to_add_contacts.php"; // GET
	public static String RESPOND_TO_ADD_CONTACT_PARAM_RESPOND = "respond";
	public static String RESPOND_TO_ADD_CONTACT_PARAM_INVITED_USER_ID = "invit_user_id";

	public static String GET_PUBLIC_NEAR_PATHS_URL = "http://dev.pitechnologies.net/fenak/get_all_near_public_paths.php"; // GET
	public static String GET_PUBLIC_NEAR_PATHS_PARAM_USER_ID = "user_id";
	public static String GET_PUBLIC_NEAR_PATHS_PARAM_CURRENT_LONGITUDE = "current_lon";
	public static String GET_PUBLIC_NEAR_PATHS_PARAM_CURRENT_LATITUDE = "current_lat";
	
	
	public static String convertStreamToString(InputStream is) {

	    BufferedReader reader = new BufferedReader(new InputStreamReader(is));
	    StringBuilder sb = new StringBuilder();

	    String line = null;
	    try {
	        while ((line = reader.readLine()) != null) {
	            sb.append(line + "\n");
	        }
	    } catch (IOException e) {
	        Log.i("io exception in convert stream to string 1", e.getMessage());
	    } finally {
	        try {
	            is.close();
	        } catch (IOException e) {
		        Log.i("io exception in convert stream to string 2", e.getMessage());
	        }
	    }
	    return sb.toString();
	}

}
